# Contributor: Jeff Bilyk <jbilyk at gmail>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=snmptt
pkgver=1.5
pkgrel=0
pkgdesc="Translates traps received from snmptrapd into easy to understand messages"
url="http://www.snmptt.org/"
arch="noarch"
license="GPL-2.0-or-later"
pkgusers="snmptt"
pkggroups="snmptt"
depends="perl perl-config-inifiles perl-list-moreutils"
install="$pkgname.pre-install"
options="!check"
subpackages="$pkgname-openrc"
source="https://downloads.sourceforge.net/snmptt/snmptt_$pkgver.tgz
	snmptt.initd
	snmptt.confd
	"
builddir="$srcdir/snmptt_$pkgver"

# secfixes:
#   1.4.2-r0:
#     - CVE-2020-24361

package() {
	for dir in /var/log/snmptt /var/spool/snmptt; do
		mkdir -p "$pkgdir"$dir && chown snmptt "$pkgdir"$dir
	done
	install -D -m755 snmptt "$pkgdir"/usr/bin/snmptt
	install -D -m755 snmptthandler "$pkgdir"/usr/bin/snmptthandler
	install -D -m755 snmpttconvert "$pkgdir"/usr/bin/snmpttconvert
	install -D -m755 snmpttconvertmib "$pkgdir"/usr/bin/snmpttconvertmib
	install -D -m644 snmptt.ini "$pkgdir"/etc/snmptt/snmptt.ini
	install -D -m644 snmptt.logrotate "$pkgdir"/etc/logrotate.d/snmptt
	install -D -m755 "$srcdir"/snmptt.initd "$pkgdir"/etc/init.d/snmptt
	install -D -m644 "$srcdir"/snmptt.confd "$pkgdir"/etc/conf.d/snmptt
}

sha512sums="
e6ec9cbe864bd4f897e71410562e303393674051f9cd2f27d8a9c0dad1c3449ebbe9ff676c2c784a40e25937ca25b76a0deba11b3187243e238014f70a74463e  snmptt_1.5.tgz
233e781150fdb217991e0d9eae4de1430e01f54c9ae7354a6ebef6676595c5497863a4ab2a829e67473c7a901c120b2dbb7aa51e67fd49fd7643ff9efca633f8  snmptt.initd
905f9c10b6daa43b112166c90d569c0737d569117c320a4a652ca22533195b559fe62628bf67bfc4df107db6af88a44ac4ffc58514c8dcc5bb45981240b90776  snmptt.confd
"
